package construction.method;

public class Test02 {

	/*
	 * 
	 * String(byte[] bytes) ,把字节数组转成字符串
	 * String(byte[] bytes, int offset, int length) ,截取字节数组的一部分转换为字符串
	 *String(char[] value) 
	 *String(char[] value, int offset, int count) 
	 *String(int[] codePoints, int offset, int count) 
	 *String(String original)，字符串常量值转换为字符串
	 *
	 *
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//从byte型数组中取得的值为阿斯克码表对应的值
		byte[] bytes=new byte[] {97,98,99,100,101};
		String str=new String(bytes);
		System.out.println("str:"+str);
		//我想得到字符串bcd；
		String str1=new String(bytes,1,3);//从索引1开始，取4位
		System.out.println(str1);
		System.out.println("=================================");
		char[] ch= {'a','b','c','d'};
		String str2=new String(ch);
		System.out.println(str2);
		//我想得到cd
		String str3=new String(ch,2,2);
		System.out.println(str3);
		System.out.println("==============================");
		//从int型数组中取得的值为阿斯克码表对应的值
		int[] arr= {97,98,99,100,101,102};
		String str4=new String(arr,3,2);
		System.out.println(str4);
		
		
		

	}

}
